import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'home',
        component: () =>
            import ('../views/HomeView.vue'),
        redirect: '/articles',
        children: [{
                path: '/articles',
                name: 'articles',
                component: () =>
                    import ('../components/ArticleList.vue')
            },
            {
                path: '/questions',
                name: 'questions',
                component: () =>
                    import ('../components/QuestionList.vue')
            },
            {
                path: '/toolView',
                name: 'tooView',
                component: () =>
                    import ('../views/ToolView.vue'),
                redirect: '/linkCollection',
                children: [{
                        path: '/linkCollection',
                        name: 'linkCollection',
                        component: () =>
                            import ('../components/LinkCollection.vue')
                    },
                    {
                        path: '/myArticles',
                        name:'myArticle',
                        component: ()=> import('../components/MyArticles.vue')
                    }
                ]
            },
            {
                path: '/chat',
                name: 'chat',
                component: () =>
                    import ('../views/ChatView.vue')
            }
        ]
    },
    {
        path: '/article',
        name: 'article',
        component: () =>
            import ('../components/Article.vue')
    },
    {
        path: '/personal',
        component: () =>
            import ('../views/PersonalView.vue'),
        redirect: '/userInfo',
        children: [{
            path: '/userInfo',
            component: () =>
                import ('../components/UserInfo.vue')
        }]
    },
    {
        path: '/articleEditor',
        component: () =>
            import ('../views/EditorView.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: () =>
            import ('../views/LoginView.vue')
    }


]

const router = new VueRouter({
    routes
})

export default router